﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace OnlineEducation.Data.Entities
{
    /// <summary>
    /// 
    /// </summary>
    /// <seealso cref="OnlineEducation.Data.Entities.EntityBase" />
    public class Booking : EntityBase
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        [Display(Name = "订单号")]
        [StringLength(100)]
        public string BookingNo { get; set; }

        [Display(Name = "订单名称")]
        public string Title
        {
            get
            {
                return this.TeachingPlan?.Course?.Title;
            }
        }

        [Display(Name = "订单金额")]
        [Required]
        public decimal TotalAmount { get; set; }

        [Display(Name = "订单折扣")]
        public decimal Discount { get; set; }

        [ForeignKey("Student")]
        public int? StudentId { get; set; }
        public ApplicationUser Student { get; set; }

        [ForeignKey("TeachingPlan")]
        public int TeachingPlanId { get; set; }
        public TeachingPlan TeachingPlan { get; set; }


        /// <summary>
        /// Gets or sets the status.
        /// </summary>
        /// <value>
        /// 0:未支付，1：支付，2：退款，9 ：取消
        /// </value>
        [Display(Name = "状态")]
        [Required]
        [DefaultValue(0)]
        
        public int Status { get; set; }//0:未支付，1：支付，2：退款，9 ：取消

    }
}
